<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .start {
            display:block ;
            width: 100px;
            height: 50px;
            margin: 0 auto;
            line-height: 50px;
            background-color: skyblue;
        }
        .login {
            position: absolute;
            display: none;
            top: 100px;
            left: 500px;
            width: 500px;
            height:300px;
            background-color: white;
        }
        .login_title {
            width: 500px;
            height: 50px;
            background-color: skyblue;
            font-size: 25px;
            line-height: 50px;
            text-align: center;
        }
        .mask {
            position: absolute;
            width: 50px;
            height:50px;
            top: -25px;
            right: -25px;
            background-color: white;
            box-sizing: border-box;
            border: 1px solid white;
            border-radius: 25px;
            line-height: 50px;
            text-align: center;
        }
        input {
            margin-left: 10px;
            width: 300px;
            height: 30px;
        }
        input[value = '登录会员'] {
            width: 300px;
            height: 40px;
            margin-top: 40px;
            margin-left: 100px;
        }
        ul {
            list-style: none;
        }
        li {
            margin-left: 40px;
            display: block;
            height: 70px;
            line-height: 100px;
        }
    </style>
</head>
<body>
    <input type="button" class="start" value="点击开始弹窗">
    <div class="login">
        <div class="login_title">登录会员</div>
        <ul>
            <li>请输入账号:<input type="text" placeholder="请输入账号:"></li>
            <li>请输入密码:<input type="password"></li>
        </ul>
        <input type="button" value="登录会员">
        <div class="mask">关闭</div>
    </div>
    <script>
        let start = document.querySelector('.start');
        let login = document.querySelector('.login');
        console.log(login.offsetParent);
        let mask = document.querySelector('.mask');
        let login_title = document.querySelector('.login_title');
        start.addEventListener('click',function (){
            login.style.display = 'block';
            document.body.style.backgroundColor = '#cccccc';
            console.log(login.offsetTop,login.offsetLeft);
            console.log(login.offsetParent);
        })
        mask.addEventListener('click',function () {
            login.style.display = 'none';
            document.body.style.backgroundColor = 'white';
        })
        login_title.addEventListener('mousedown',function (e) {
            let x = e.pageX - login.offsetLeft;
            let y = e.pageY - login.offsetTop;
            document.addEventListener('mousemove',move)
            function move(e) {
                console.log(x+','+y);
                login.style.left = e.pageX - x + 'px';
                login.style.top = e.pageY - y + 'px';
            }

            document.addEventListener('mouseup', function() {
                document.removeEventListener('mousemove', move);
            })
        })
    </script>
</body>
</html>